﻿using System.Runtime.InteropServices;
using OnDash.Windowing.GraphicsLibraryFramework.Enums;

namespace OnDash.Windowing.GraphicsLibraryFramework;

public unsafe struct GlfwCallbacks
{
    [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
    public delegate void CharCallback(Window* window, uint codepoint);

    [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
    public delegate void CharModsCallback(Window* window, uint codepoint, KeyModifiers modifiers);

    [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
    public delegate void CursorEnterCallback(Window* window, bool entered);

    [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
    public delegate void CursorPosCallback(Window* window, float x, float y);

    [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
    public delegate void DropCallback(Window* window, int count, byte** paths);

    [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
    public delegate void JoystickCallback(int joystick, ConnectedState state);

    [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
    public delegate void KeyCallback(Window* window, Keys key, int scanCode, InputAction action, KeyModifiers mods);

    [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
    public delegate void MouseButtonCallback(Window* window, MouseButton button, InputAction action, KeyModifiers mods);

    [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
    public delegate void ScrollCallback(Window* window, float offsetX, float offsetY);

    [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
    public delegate void MonitorCallback(Monitor* monitor, ConnectedState state);

    [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
    public delegate void WindowCloseCallback(Window* window);

    [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
    public delegate void WindowFocusCallback(Window* window, bool focused);

    [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
    public delegate void WindowIconifyCallback(Window* window, bool iconified);

    [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
    public delegate void WindowMaximizeCallback(Window* window, bool maximized);

    [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
    public delegate void FramebufferSizeCallback(Window* window, int width, int height);

    [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
    public delegate void WindowContentScaleCallback(Window* window, float scaleX, float scaleY);

    [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
    public delegate void WindowPosCallback(Window* window, int x, int y);

    [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
    public delegate void WindowSizeCallback(Window* window, int width, int height);

    [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
    public delegate void ErrorCallback(ErrorCode error, string description);

    [UnmanagedFunctionPointer(CallingConvention.Cdecl)]
    public delegate void WindowRefreshCallback(Window* window);
}